package com.iandun.web.framework.core.exception.customize;

import com.iandun.web.framework.core.http.ResponseStatus;
import lombok.Getter;
import lombok.Setter;

/**
 * 基础业务异常
 *
 * <ol>
 *     <li>作为基础的业务异常,通常用于定义业务中发生的异常</li>
 *     <li>仅用于处理运行过程中异常切面捕捉到的业务异常</li>
 *     <li>仅用于通常的HTTP请求响应交互中</li>
 * </ol>
 *
 * @author :jason.liang
 * @date: 2021-05-19 17:42
 */
@Getter
@Setter
public class BusinessException extends RuntimeException {

    private int errCode;

    private String errMsg;

    public BusinessException(int errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public BusinessException(ResponseStatus status) {
        this.errCode = status.getCode();
        this.errMsg = status.getMsg();
    }
}
